package com.ibangnuo.manage.controller.wxpay;

import com.ibangnuo.api.wxpay.WxMerchantsIntoPiecesControllerApi;
import com.ibangnuo.framework.domain.CommercialTenantDetailsWx;
import com.ibangnuo.framework.model.response.ObjectResult;
import com.ibangnuo.manage.service.wxpay.WxMerchantsIntoPiecesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @Author: wwy
 * @Date: 2020-01-18 21:34
 */
@RestController
@RequestMapping("/WxIntoPieces")
public class WxMerchantsIntoPiecesController implements WxMerchantsIntoPiecesControllerApi {
    @Autowired
    private WxMerchantsIntoPiecesService wxMerchantsIntoPiecesService;
    /**
     * 商户添加
     * @param commercialTenantDetailsWx
     * @return
     */
    @PostMapping("/add")
    @Override
    public ObjectResult add(@RequestBody CommercialTenantDetailsWx commercialTenantDetailsWx) {
        return wxMerchantsIntoPiecesService.add(commercialTenantDetailsWx);
    }

    /**
     * 根据id获取商户进件
     * @param id
     * @return
     */
    @GetMapping("/findById/{id}")
    @Override
    public ObjectResult findById(@PathVariable("id") String id) {
        return wxMerchantsIntoPiecesService.findById(id);
    }

    /**
     * 根据商户id，获取商户进件
     * @param commercialId
     * @return
     */
    @GetMapping("/findByCommercialId/{commercialId}")
    @Override
    public ObjectResult findByCommercialId(@PathVariable("commercialId") String commercialId) {
        return wxMerchantsIntoPiecesService.findByCommercialId(commercialId);
    }
}
